package stone;

class Solution {
    public int removeStones(int[][] stones) {
        int leaveStone =0;
        int row =0;
        int column =0;
        for (int i = 0; i <stones.length ; i++) {
            if (stones[i][0]>row)
                row =stones[i][0];
            if (stones[i][1]>column)
                row =stones[i][1];
        }
        boolean[][] map = new boolean[row][column];
        for (int i = 0; i <stones.length ; i++){
            map[stones[i][0]][stones[i][1]] = true;
        }

        for (int i = 0; i <stones.length ; i++) {
            if (map[stones[i][0]][stones[i][1]] == false){
                findFriends(map,stones[i]);
                leaveStone++;
            }

        }

        return stones.length-leaveStone;
    }
    void findFriends(boolean[][] stones,int[] index){

    }
}